<?php
	session_start();
	require_once '../connection.php';

	//$newFilename	= copyFile();
	
	if (!isset($_SESSION['uid']))
			die (json_encode (array ('message'=>'Du må være pålogget for å gjøre dette!')));
	
	$sql = 'INSERT INTO requests (uid, title, description, deadline, bid, completed, attachment, addedDate) VALUES (?, ?, ?, ?, ?, ?, ?, now())';
	
	$sth = $db->prepare ($sql);
	//-1 skal byttes ut med brukerIDen
	$sth->execute (array ($_SESSION['uid'], $_POST['title'], $_POST['description'], $_POST['deadline'], $_POST['bid'], "no", $_POST['file'])); //$_SESSION['user']

	echo json_encode (array ('ok'=>'OK'));

?>